package modelo.servlets;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import modelo.logica.Aluno;
import modelo.logica.Endereco;
import modelo.logica.Estado;
import modelo.logica.Funcionario;
import modelo.logica.Grupo;
import modelo.logica.Responsavel;

/**
 * Servlet implementation class cadastroServlet
 */
public class cadastroProfServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
    
    public cadastroProfServlet() {
        super();
        
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		modelo.bd.Acess.inicializaBD();
		
		int prof = Integer.parseInt(request.getParameter("professor"));
		int grp = Integer.parseInt(request.getParameter("grupo"));
		
		Grupo grupo = modelo.bd.Acess.getGrupo(grp);
		Funcionario professor = modelo.bd.Acess.getFuncionario(prof);
		grupo.setProfessor(professor);
	    
		modelo.bd.Acess.inicializaBD();
		if (modelo.bd.Acess.updateGrupo(grupo))
			response.sendRedirect("cadprofessor.jsp");
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {


		
	}

}
